<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>像素生存者 - Pixel Survivor</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #000;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            font-family: 'Courier New', monospace;
        }

        #game-container {
            border: 2px solid #333;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
        }

        #loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: #00ff00;
            font-size: 24px;
            text-align: center;
            z-index: 1000;
        }

        .loading-bar {
            width: 300px;
            height: 20px;
            border: 2px solid #00ff00;
            margin: 20px auto;
            position: relative;
            background: #000;
        }

        .loading-fill {
            height: 100%;
            background: linear-gradient(90deg, #00ff00, #00ffff);
            width: 0%;
            transition: width 0.3s ease;
        }

        .game-info {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            color: #888;
            font-size: 12px;
            text-align: center;
        }

        /* 移动端适配 */
        @media (max-width: 768px) {
            body {
                padding: 10px;
            }
            
            #game-container {
                border: 1px solid #333;
                border-radius: 4px;
            }
            
            #loading {
                font-size: 18px;
            }
            
            .loading-bar {
                width: 250px;
                height: 15px;
            }
        }

        /* 触摸设备优化 */
        @media (hover: none) and (pointer: coarse) {
            body {
                user-select: none;
                -webkit-user-select: none;
                -webkit-touch-callout: none;
            }
        }
    </style>
</head>

<body>
    <div id="loading">
        <div>🎮 像素生存者正在加载...</div>
        <div class="loading-bar">
            <div class="loading-fill" id="loading-fill"></div>
        </div>
        <div>请稍候...</div>
    </div>

    <div id="game-container"></div>
    
    <div class="game-info">
        <div>像素生存者 v1.0 | 构建版本: BUILD_VERSION</div>
        <div>使用 WASD 或方向键移动，鼠标瞄准射击</div>
    </div>
    
    <script src="phaser.min.js"></script>
    <script src="game.js?v=BUILD_HASH"></script>
    
    <script>
        // 加载进度模拟
        let progress = 0;
        const loadingFill = document.getElementById('loading-fill');
        const loadingElement = document.getElementById('loading');
        
        const updateProgress = () => {
            progress += Math.random() * 15;
            if (progress > 100) progress = 100;
            
            loadingFill.style.width = progress + '%';
            
            if (progress >= 100) {
                setTimeout(() => {
                    loadingElement.style.display = 'none';
                }, 500);
            } else {
                setTimeout(updateProgress, 100);
            }
        };
        
        // 开始加载动画
        setTimeout(updateProgress, 200);
        
        // 游戏加载完成后隐藏加载界面
        window.addEventListener('load', () => {
            setTimeout(() => {
                if (loadingElement) {
                    loadingElement.style.display = 'none';
                }
            }, 1000);
        });
    </script>
</body>

</html>
